import request from "@/router/axios";

// eslint-disable-next-line require-jsdoc
export function fetchList (query) {
  return request({
    url: "/job/sys-job/page",
    method: "get",
    params: query
  });
}

// eslint-disable-next-line require-jsdoc
export function getJobLogList (query) {
  return request({
    url: "/job/sys-job/job-log",
    method: "get",
    params: query
  });
}

// eslint-disable-next-line require-jsdoc
export function shutdownJobsRa () {
  return request({
    url: "/job/sys-job/shutdown-jobs",
    method: "post"
  });
}

// eslint-disable-next-line require-jsdoc
export function startJobsRa () {
  return request({
    url: "/job/sys-job/start-jobs",
    method: "post"
  });
}

// eslint-disable-next-line require-jsdoc
export function refreshJobsRa () {
  return request({
    url: "/job/sys-job/refresh-jobs",
    method: "post"
  });
}

// eslint-disable-next-line require-jsdoc
export function startJobRa (jobId) {
  return request({
    url: "/job/sys-job/start-job/" + jobId,
    method: "post"
  });
}

// eslint-disable-next-line require-jsdoc
export function runJobRa (jobId) {
  return request({
    url: "/job/sys-job/run-job/" + jobId,
    method: "post"
  });
}

// eslint-disable-next-line require-jsdoc
export function shutDownJobRa (jobId) {
  return request({
    url: "/job/sys-job/shutdown-job/" + jobId,
    method: "post"
  });
}

// eslint-disable-next-line require-jsdoc
export function addObj (obj) {
  return request({
    url: "/job/sys-job",
    method: "post",
    data: obj
  });
}

// eslint-disable-next-line require-jsdoc
export function getObj (id) {
  return request({
    url: "/job/sys-job/" + id,
    method: "get"
  });
}

// eslint-disable-next-line require-jsdoc
export function delObj (id) {
  return request({
    url: "/job/sys-job/" + id,
    method: "delete"
  });
}

// eslint-disable-next-line require-jsdoc
export function putObj (obj) {
  return request({
    url: "/job/sys-job",
    method: "put",
    data: obj
  });
}

// eslint-disable-next-line require-jsdoc
export function isValidTaskName (query) {
  return request({
    url: "/job/sys-job/is-valid-task-name",
    method: "get",
    params: query
  });
}
